#pragma once

#include "hzpch.h"
#include "Core.h"
#include "SourceCode/Events/Event.h"

namespace Hazal
{
	/// <summary>
	/// 窗口属性结构体
	/// </summary>
	struct SWindowProps
	{
		SWindowProps(const std::string& strTitle = "Hazal Engine", 
					unsigned int unWidth = 1280, 
					unsigned int unHeight = 720)
			: m_strTitle(strTitle), m_unWidth(unWidth), m_unHeight(unHeight)
		{
		}

		std::string m_strTitle;
		unsigned int m_unWidth;
		unsigned int m_unHeight;
	};

	/// <summary>
	/// 窗口基类, 不依赖于特定平台
	/// </summary>
	class HZ_DLL_OPTION CWindow
	{
	public:
		CWindow(){}

		virtual ~CWindow() {}

	public:
		/// <summary>
		/// 窗口事件回调函数
		/// </summary>
		using EventCallbackFn = std::function<void(CEvent&)>;

	public:
		/// <summary>
		/// 更新窗口
		/// </summary>
		virtual void OnUpdate() = 0;

		/// <summary>
		/// 设置窗口宽度
		/// </summary>
		/// <returns></returns>
		virtual unsigned int GetWidth() const = 0;

		/// <summary>
		/// 设置窗口高度
		/// </summary>
		/// <returns></returns>
		virtual unsigned int GetHeight() const = 0;

		/// <summary>
		/// 获取窗口一帧刷新事件(second)
		/// </summary>
		virtual float GetFrameTime() = 0;

		/// 窗口属性
		virtual void SetEventCallback(const EventCallbackFn& callback) = 0;

		/// <summary>
		/// 设置垂直同步
		/// </summary>
		/// <param name="bEnabled"></param>
		virtual void SetVSync(bool bEnabled) = 0;

		/// <summary>
		/// 判断垂直同步是否开启
		/// </summary>
		/// <returns></returns>
		virtual bool IsVSync() const = 0;

		/// <summary>
		/// 获取窗口指针
		/// </summary>
		/// <returns></returns>
		virtual void* GetNativeWindow() const = 0;

		/// <summary>
		/// 创建窗口对象指针, 由子类覆写该方法
		/// </summary>
		/// <param name="props"></param>
		/// <returns></returns>
		static CWindow* Create(const SWindowProps& props = SWindowProps());
	};
}